package services

import (
	"jlpay-sdk-go/pkg/jlpay/core"
	"jlpay-sdk-go/pkg/jlpay/models"
)

// MerchantService 商户服务
type MerchantService struct {
	*BaseService
}

// NewMerchantService 创建商户服务
func NewMerchantService(config *core.Config) *MerchantService {
	return &MerchantService{
		BaseService: NewBaseService(config),
	}
}

// MerchantIncomingAdd 商户进件
func (s *MerchantService) MerchantIncomingAdd(request *models.MerchantIncomingAddRequest) (*models.MerchantIncomingAddResponse, error) {
	response := &models.MerchantIncomingAddResponse{}
	err := s.Post(request, response, "/open/merch/access/incoming/add")
	if err != nil {
		return nil, err
	}
	return response, nil
}

// MerchantIncomingModify 商户进件修改
func (s *MerchantService) MerchantIncomingModify(request *models.MerchantIncomingModifyRequest) (*models.MerchantIncomingModifyResponse, error) {
	response := &models.MerchantIncomingModifyResponse{}
	err := s.Post(request, response, "/open/merch/access/incoming/modify")
	if err != nil {
		return nil, err
	}
	return response, nil
}

// RealnameQuery 微信支付宝认证查询
func (s *MerchantService) RealnameQuery(request *models.RealnameQueryRequest) (*models.RealnameQueryResponse, error) {
	response := &models.RealnameQueryResponse{}
	err := s.Post(request, response, "/open/merch/access/realname/query")
	if err != nil {
		return nil, err
	}
	return response, nil
}
